﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace PersonaLibrary.Converters
{
    public class VisibleConverter : IValueConverter
    {
        public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is bool)
            {
                if ((bool)value) return System.Windows.Visibility.Visible;
                else
                    return System.Windows.Visibility.Hidden;
            }
            return null;
        }

        public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is System.Windows.Visibility)
            {
                if (((System.Windows.Visibility)value) == System.Windows.Visibility.Visible) return true;
                else return false;
            }
            return null;
        }
    }
}
